﻿@{
    Layout = null;
}
@*添加认证*@
<script src="~/Scripts/MGJJS/Auth/AuthList_V.js"></script>
<style>
    .btns {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .picker {
        position: relative;
    }

        .picker .webuploader-pick {
            display: block;
            width: 200px !important;
            height: 200px !important;
        }

        .picker input[type='file'] {
            opacity: 0;
            display: block;
            width: 200px;
            height: 200px;
            position: absolute;
            z-index: 99;
        }
</style>

<script src="~/Scripts/WebUploader/webuploader.min.js"></script>
@*<script src="~/Scripts/WebUploader/webuploader.js"></script>*@

<div id="Wrap">
    <form role="form" id="firstForm">

        <input type="Hidden" id="AuthId" name="Id" value="@ViewBag.AuthId" />

        <div class="row form-group">
            <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-right"><span class="red-600">*</span>&nbsp;类型:</div>
            <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">
                <!--
                 <input type="text" id="AuthType" name="AuthType" class="form-control" placeholder="请输入认证类型" maxlength="25">
                -->


                <select class="form-control" id="Category" name="Category">
                    <option value="0">企业证照</option>
                    <option value="1">质检报告</option>
                    <option value="2">荣誉证书</option>
                    <option value="3">其他</option>
                </select>

            </div>
        </div>


        <div class="row form-group">

            <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-right"><span class="red-600">*</span>&nbsp;名称:</div>

            <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">


                    <input type="text" id="AuthName" name="AuthName"  class="form-control" placeholder="请输入认证记录名称(企业证照)" maxlength="25">

            </div>
        </div>

    </form>


    <div id="ListWrap">




        @*<form role="form">
            <input type="hidden" name="Id" value="0" />
            <div class="row" style="margin-top:15px;">
                <div class="col-xs-12 col-md-12" style="position:relative">
                    <div class="col-xs-5 col-md-5">

                        <!--
                           <img style="width:100%;border:1px solid #e5e5e5" src="~/Content/userImgs/Product/ProductNullImg.png" />
                            -->

                        <div id="thelist" class="uploader-list" style="display:flex;align-items:center">

                            <input type="hidden" name="Picture" value="" />

                            <div id="picker" class="picker" style="background: url('/Content/webImgs/upLogo/cp_img_tj.png' );background-size:100% 100%;width:200px;height:200px;border-radius:5px;background-repeat:no-repeat"></div>
                        </div>
                    </div>
                    <div class="col-xs-7 col-md-7" style="position:relative;">
                        <input type="text" class="form-control" placeholder="输入名称(如荣誉证书)" name="ModuleName" style="margin-bottom:10px;">
                        <textarea class="form-control" name="Content" placeholder="输入描述"></textarea>
                        <div class="row">
                            <span class="col-xs-4 col-md-4">是否显示：</span>
                            <div class="col-xs-4 col-md-4"><input type="radio" name="IsH5" value="0" checked />&nbsp;是</div>
                            <div class="col-xs-4 col-md-4"><input type="radio" name="IsH5" value="1" />&nbsp;否</div>
                        </div>

                        <div class="row">
                            <button class="btn btn-primary" type="button" data-id="0" onclick="$.MGJ.AuthList_V.ValidatorModuleSave(this)" style="float:right;margin-right:80px;">保存</button>
                            <!--
                                    <button class="btn btn-primary" type="button" onclick="$.MGJ.AuthList_V.AddRow()" >添加</button>
                            -->

                        </div>
                    </div>
                </div>
            </div>
        </form>*@


    </div>

    <button class="btn btn-primary" type="button" onclick="$.MGJ.AuthList_V.AddRow()" style="width:100%;margin-top:20px;">添加</button>

</div>


<script>
    var pickerNub = 0;

    $(document).ready(function () {


        var authId = $("#AuthId").val();
        if (authId != 0) {
            $.MGJ.AuthList_V.Ajax_GetAuthModelByAuthId(authId);
            $.MGJ.AuthList_V.Ajax_GetAuthModuleListByAuthId(authId);
        }

    });

    var selector;

    //$(function () {

    //    var uploader = WebUploader.create({

    //        // swf文件路径
    //        //        swf: BASE_URL + '/js/Uploader.swf',
    //        //指定拖拽容器
    //        dnd: '#thelist',
    //        //dnd:'.uploader-list',


    //        //截图可粘贴区域
    //        paste: 'document.body',

    //        // 文件接收服务端。
    //        server: '/Upload/Upload',

    //        // 选择文件的按钮。可选。
    //        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
    //        //pick: {
    //        //    id: '#picker',
    //        //    multiple: false
    //        //},

    //        pick: "#picker",

    //        accept: {
    //            title: 'Images',
    //            extensions: 'gif,jpg,jpeg,bmp,png',
    //            mimeTypes: 'image/jpg,image/jpeg,image/png'
    //        },

    //        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
    //        resize: false
    //    });


    //    $(document).on('click', '.picker', function () {

    //        selector = $(this);

    //    });

    //    LoadItem(uploader, "#thelist", "#picker");

    //});


    $('#firstForm').bootstrapValidator({
        fields: {
            AuthType: {
                validators: {
                    notEmpty: {
                        message: '认证类型不能为空'
                    },
                    stringLength: {
                        max: 25,
                        message: '认证类型最大长度为25',
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
                        message: '认证类型不能输入符号'
                    }
                }

            },
            //AuthLicence: {
            //    validators: {
            //        notEmpty: {
            //            message: '企业证照不能为空'
            //        },
            //        stringLength: {
            //            max: 25,
            //            message: '企业证照最大长度为25',
            //        },
            //        regexp: {
            //            regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
            //            message: '企业证照不能输入符号'
            //        }
            //    }
            //}
        }
    })
</script>


